package com.lc.hot100.lc73;

public class Main {

}

class Solution {
    public void setZeroes(int[][] matrix) {
        int n = matrix.length;
        int m = matrix[0].length;
        
        boolean[] nn = new boolean[n];
        boolean[] mm = new boolean[m];
        
        for (int i = 0; i < n; i ++) {
        	for (int j = 0; j < m; j ++) {
        		if (matrix[i][j] == 0) {
        			mm[i] = true;
        			nn[j] = true;
        		}
        	}
        }
        
        for (int i = 0; i < n; i ++) {
        	for (int j = 0; j < m; j ++) {
        		if (mm[i]|| nn[j]) {
        			matrix[i][j] = 0;
        		}
        	}
        }
    }
}
